package cn.lg.soar.boot.fc.controller;

import cn.lg.soar.boot.client.entity.ClientUser;
import cn.lg.soar.boot.client.service.ClientUserService;
import cn.lg.soar.boot.fc.entity.Contract;
import cn.lg.soar.boot.fc.entity.TenancyRoom;
import cn.lg.soar.boot.fc.entity.vo.ContractVo;
import cn.lg.soar.boot.fc.entity.vo.RepairVo;
import cn.lg.soar.boot.fc.entity.vo.RoomVo;
import cn.lg.soar.boot.fc.entity.vo.TenancyRoomVo;
import cn.lg.soar.boot.fc.service.ContractService;
import cn.lg.soar.boot.fc.service.RoomService;
import cn.lg.soar.boot.fc.service.StatService;
import cn.lg.soar.boot.fc.service.TenancyRoomService;
import cn.lg.soar.common.model.HttpResult;
import cn.lg.soar.common.model.PageQuery;
import cn.lg.soar.common.model.PageResult;
import cn.lg.soar.core.annotations.IdempotentByParam;
import cn.lg.soar.core.annotations.constraints.group.Create;
import cn.lg.soar.core.annotations.constraints.group.Update;
import cn.lg.soar.database.base.controller.BaseController;
import cn.lg.soar.database.query.QueryParams;
import cn.lg.soar.mvc.annotations.Log;
import cn.lg.soar.mvc.enums.ControllerConst;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Api(tags = "统计")
@Validated
@RestController
@RequestMapping("fc/stat")
public class StatController {

    @Autowired
    private StatService statService;
    @Autowired
    private RoomService roomService;
    /** 客户端用户信息服务 */
    @Autowired private ClientUserService clientUserService;

    @ApiOperation(value = "楼栋统计")
    @RequestMapping(path = "buildingStat", method = RequestMethod.GET)
    public HttpResult<Map<String, Object>> buildingStat(){

        return statService.buildingStat();
    }

    @ApiOperation(value = "房间统计")
    @RequestMapping(path = "roomStat", method = RequestMethod.GET)
    public HttpResult<Map<String, Object>> roomStat(){

        return statService.roomStat();
    }

    @ApiOperation(value = "收费统计")
    @RequestMapping(path = "financeStat", method = RequestMethod.GET)
    public HttpResult<Map<String, Object>> financeStat(){

        return statService.financeStat();
    }

    @ApiOperation(value = "报修统计")
    @RequestMapping(path = "repairStat", method = RequestMethod.GET)
    public HttpResult<Map<String, Object>> repairStat(){

        return statService.repairStat();
    }

    @ApiOperation(value = "最新报修")
    @RequestMapping(path = "newRepair", method = RequestMethod.GET)
    public HttpResult<RepairVo> newRepair(){

        return statService.newRepair();
    }

    @ApiOperation(value = "基础数据统计")
    @RequestMapping(path = "baseDataStat", method = RequestMethod.GET)
    public HttpResult<Map<String, Object>> baseDataStat(){

        return statService.baseDataStat();
    }

    @ApiOperation(value = "最新租房")
    @RequestMapping(path = "newTenancyRoom", method = RequestMethod.GET)
    public HttpResult<TenancyRoomVo> newTenancyRoom(){

        return statService.newTenancyRoom();
    }

    @ApiOperation(value = "租房统计")
    @RequestMapping(path = "tenancyRoomStat", method = RequestMethod.GET)
    public HttpResult<Map<String, Object>> tenancyRoomStat(){

        return statService.tenancyRoomStat();
    }

}